{extend name="base"/}
{block name="title"}
    {:lang('订单管理')}
{/block}
{block name="css"}
<link rel="stylesheet" href="__MOBILE__/css/wy.css">
<style>
    body{background: #f5f5f5; }
    .con{display: block !important;}
    .on>div{margin: 2rem 0 0 0 ; display: none;}
    .goods{background: #fff;}
    .con_right {float: left !important;display: unset;margin-left: .2rem !important;margin-right: unset;}
    .list_t h4 {width: 70%;}
    .list_t {border-bottom: 0.02rem solid #eee;}
    .shop_num{float:left;}
    .shop_jin{float:left;}
</style>
{/block}
{block name="content"}
<!-- 头部 -->
<div class="head">
        <div class="head_left">
            <a href="javascript:history.go(-1)"><img src="__MOBILE__/images/true.png" alt=""></a>
        </div>
        <div class="head_con">{:lang('订单管理')}</div>
    </div>

<ul class="tab">
    <li class="tab_the">{:lang('未发货')}</li>
    <li>{:lang('派送中')}</li>
    <li>{:lang('已签收')}</li>
</ul>

<div class="on"> 

    <div class="con">
        {foreach $todeliver as $key=>$vo }
            <div class="goods">
                <ul>
                {foreach $vo as $k=>$vov }
                    <li>
                        <div class="list_t">
                            <a href="{:url('/langjinmobile/card/goodsdata',['good_id'=>$vov.goods_id])}">
                                <img src="{$vov.goodsimg}" alt="">
                                <h4>{:lang($vov.gname)}</h4>
                                <div class="con_right">
                                    <p class="model">GMOB:{$vov.wallet_num}</p>
                                    <p class="model" style="margin-top:0;">GMOD:{$vov.integral_num}</p>
                                </div>
                                <div class="con_right">
                                    <p class="mon"><span></span>数量</p>
                                    <p class="onum"><span>×</span>{$vov.num}</p>
                                </div>
                            </a>
                        </div>
                    </li>
                {/foreach}
                </ul>
                <div class="subto">
                    <div class="subto_left">
                        <p class="shop_num">{:lang('共')}<span>{$todeliver_anl[$key]['tnum']}</span>{:lang('件商品')}</p>
                        <p class="shop_jin">{:lang('合计:')}<span>{$todeliver_anl[$key]['sum_money']}GMOB{$todeliver_anl[$key]['sum_integral']}GMOD</span></p>
                    </div>
                    <a class="remind the_go" href="javascript:" data-id="{$key}">{:lang('商品发货')}</a>
                </div>
            </div>
        {/foreach}
    </div>


    <div>
            {foreach $ondelivering as $key=>$vo }
            <div class="goods">
                <ul>
                {foreach $vo as $k=>$vov }
                    <li>
                        <div class="list_t">
                            <a href="{:url('/langjinmobile/card/goodsdata',['good_id'=>$vov.goods_id])}">
                                <img src="{$vov.goodsimg}" alt="">
                                <h4>{:lang($vov.gname)}</h4>
                                <div class="con_right">
                                    <p class="model">运单号:</p>
                                    <p class="model" style="margin-top:0;">{$vov.ship_num}</p>
                                </div>
                                <div class="con_right">
                                    <p class="mon"><span></span>数量</p>
                                    <p class="onum"><span>×</span>{$vov.num}</p>
                                </div>
                            </a>
                        </div>
                    </li>
                {/foreach}
                </ul>
                <div class="subto">
                    <div class="subto_left">
                        <p class="shop_num">{:lang('共')}<span>{$ondelivering_anl[$key]['tnum']}</span>{:lang('件商品')}</p>
                        <p class="shop_jin">{:lang('合计:')}<span>{$ondelivering_anl[$key]['sum_money']}GMOB{$ondelivering_anl[$key]['sum_integral']}</span></p>
                    </div>
                </div>        
            </div>
            {/foreach}
    </div>

    <div>
            {foreach $hasdone as $key=>$vo }
            <div class="goods">
                    <ul>
                    {foreach $vo as $k=>$vov }
                        <li>
                            <div class="list_t">
                                <a href="{:url('/langjinmobile/card/goodsdata',['good_id'=>$vov.goods_id])}">
                                    <img src="{$vov.goodsimg}" alt="">
                                    <h4>{:lang($vov.gname)}</h4>
                                    <div class="con_right">
                                        <p class="model">运单号:</p>
                                    <p class="model" style="margin-top:0;">{$vov.ship_num}</p>
                                    </div>
                                    <div class="con_right">
                                        <p class="mon"><span></span>数量</p>
                                        <p class="onum"><span>×</span>{$vov.num}</p>
                                    </div>
                                </a>
                            </div>
                        </li>
                    {/foreach}
                    </ul>
                    <div class="subto">
                        <div class="subto_left">
                            <p class="shop_num">{:lang('共')}<span>{$hasdone_anl[$key]['tnum']}</span>{:lang('件商品')}</p>
                            <p class="shop_jin">{:lang('合计:')}<span>{$hasdone_anl[$key]['sum_money']}GMOB{$hasdone_anl[$key]['sum_integral']}</span></p>
                        </div>
                    </div>
                </div>
                {/foreach}
    </div>

</div>



<div class="popup">
    <div class="pop_con">
        <div class="pop_con_tit">{:lang('确认收货')}</div>
        <div class="pop_con_con">
            <p style="color: #666;">{:lang('请确认并核实您所购买')}</p>
            <p>{:lang('的物品后进行确认')}</p>
        </div>
        <div class="pop_last">{:lang('确定')}</div>
    </div>
</div>



{/block}
{block name="js"}

<!-- tab切换 -->
<script>
$(".tab li").click(function(){
    var Oindex = $('.tab li').index($(this));
    console.log(Oindex);
    $(".tab li").removeClass("tab_the").eq(Oindex).addClass("tab_the");
    console.log($('.on>div').length)

    $(".on>div").removeClass('con').eq(Oindex).addClass('con');
});

//商品发货
$(".the_go").click(function(){
    var order_number = $(this).attr('data-id');
    var url = '/langjinmobile/Merchant_order/ship/order_number/'+order_number;
    console.log(order_number);
    $.get(url,function(res){
        if(res.status == 0)
        {
            msg_alert(res.msg);
            return false;
        }else{
            window.location.href = url;
        }
    })
});

//商品编辑
$(".the_edit").click(function(){
    var order_number = $(this).attr('data-id');
    var url = '/langjinmobile/Merchant_order/edit/order_number/'+order_number;
    console.log(order_number);
    $.get(url,function(res){
        if(res.status == 0)
        {
            msg_alert(res.msg);
            return false;
        }else{
            window.location.href = url;
        }
    })
});

//订单详情
$(".the_detail").click(function(){
    var order_number = $(this).attr('data-id');
    var url = '/langjinmobile/Merchant_order/detail/order_number/'+order_number;
    console.log(order_number);
    $.get(url,function(res){
        if(res.status == 0)
        {
            msg_alert(res.msg);
            return false;
        }else{
            window.location.href = url;
        }
    })
});
</script>

{/block}